package com.hzhc.Thread;

import com.hzhc.enumBean.MessageCode;
import com.hzhc.service.SmsTemplateService;
import com.hzhc.vo.TrainPlanVo;
import lombok.extern.log4j.Log4j2;

/**
 * @author wuxiaoke
 * @version 1.0
 * @description:
 * @date 2021/10/9 10:57 上午
 */
@Log4j2
public class SendMessageThread implements Runnable{

    private TrainPlanVo trainPlanVo;

    private SmsTemplateService smsTemplateService;



    public SendMessageThread(TrainPlanVo trainPlanVo, SmsTemplateService smsTemplateService) {
        this.trainPlanVo = trainPlanVo;
        this.smsTemplateService = smsTemplateService;
    }

    @Override
    public void run() {
        //发送短信
        String[] params = {trainPlanVo.getBeginStation()};
        log.info("发送短信：{}，{}",trainPlanVo.getTelephone(),params);
        smsTemplateService.sendSms(trainPlanVo.getTelephone(),null,params, MessageCode.TSLYDXT.getName());
    }
}
